//
//  CXMineViewController.m
//  Delicious
//
//  Created by dllo on 15/11/24.
//  Copyright © 2015年 doll. All rights reserved.
//

#import "CXMineViewController.h"
#import "CXCollectionTableViewCell.h"
#import "CXDelteTableViewCell.h"
#import "CXAdviceTableViewCell.h"

@interface CXMineViewController ()<UITableViewDataSource, UITableViewDelegate>
@property (nonatomic, retain) UITableView *tableView;
@property (nonatomic, retain) NSMutableArray *dataArr;
@property (nonatomic, retain) UILabel *titleLabel;
@property (nonatomic, retain) UIImageView *headImage;
@end

@implementation CXMineViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100 * WIDTH1, 40 * HEIGHT1)];
    self.titleLabel.text = @"我的";
    self.titleLabel.backgroundColor = [UIColor clearColor];
    self.titleLabel.font = [UIFont boldSystemFontOfSize:20 * WIDTH1];
    self.titleLabel.textColor = [UIColor whiteColor];
    self.titleLabel.textAlignment = NSTextAlignmentCenter;
    self.navigationItem.titleView = self.titleLabel;
    [self createTableView];
    //头视图
    
    self.headImage = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 250 * HEIGHT1)];
    [self.headImage setImage:[UIImage imageNamed:@"95704A8D-0679-4219-8424-9E1134087B64.png"]];
    [self.view addSubview:self.headImage];
    self.headImage.backgroundColor = [UIColor orangeColor];
    self.tableView.tableHeaderView = self.headImage;
    
    
    
    
}
//创建tabView
- (void)createTableView
{
    self.tableView = [[UITableView alloc] initWithFrame:self.view.frame style:UITableViewStylePlain];
    self.tableView.dataSource = self;
    self.tableView.delegate = self;
    [self.view addSubview:self.tableView];
    //注册
    [self.tableView registerClass:[CXCollectionTableViewCell class] forCellReuseIdentifier:@"Ccell"];
    [self.tableView registerClass:[CXDelteTableViewCell class] forCellReuseIdentifier:@"Dcell"];
    [self.tableView registerClass:[CXAdviceTableViewCell class] forCellReuseIdentifier:@"Acell"];
}
#pragma mark -- tabView的协议方法
//cell个数
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 3;
}

//cell内容
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (0 == indexPath.row) {
        CXCollectionTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Ccell"];
        return cell;
    }if (1 == indexPath.row) {
        CXDelteTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Dcell"];
        return cell;

    }else{
        CXAdviceTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Acell"];
        return cell;
    }
    
}
//点击cell
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [self.tableView deselectRowAtIndexPath:indexPath animated:YES];
}
//行高
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 50;
}





- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
